Imports System.Collections.Generic
Imports System.Text

Namespace Core


	'    _______________________
	' 0 | Number of next        |  ^
	' 1 | available block       |  |
	' 2 | for appending data    | Header
	' 3 | (binary)              |  |
	'   |-----------------------|  |
	' 4 | ( Reserved )          |  |
	'   | Size of blocks      *1|  |
	'   |                       |  |
	' 7 |                       |  |
	'   |-----------------------|  |
	' 8 | DBF file name         |  |
	'   | without extention     |  |
	'   :                       :  |
	'15 |                       |  |
	'   |-----------------------|  |
	'16 | Reserved   (00h)      |  | <-3 when Dbase 3
	'   |-----------------------|  |
	'17 | ( Reserved )          |  |
	'18 |                       |  |
	'19 |                       |  |
	'   |-----------------------|  |
	'20 | Block length in bytes |  |
	'21 |                     *4|  |
	'   |-----------------------|  |
	'22 | ( Reserved )          |  |
	'   |                       |  |
	'   | (i.e. garbage)        |  |
	'   :                       :  |
	'   :                       :  |
	'511|                       |  |
	'   |=======================| _v_____
	'  1|                       |  ^                 Used block
	'   |                       |  ^           __  |=======================|
	'   |                       |  |          /   0| ( Reserved )          |
	'   :                       :  |         /    1|                       |
	'   :                       :  |        /     2|  FFh FFh 08h 00h      |
	'   |                       |  |       /      3|                       |
	'511|                       |  |      /        |-----------------------|
	'   |=======================| _|_____/        4| Length of memo field  |
	'  1|                       |  |              5|                       |
	'   :                       :  |              6|                       |
	'   :                       :  |              7|                       |
	'   |                       |  |               |-----------------------|
	'511|                       | _|_____         8| Memo data           *2|
	'   |=======================|  |     \         :                       :
	'   |                       |  |      \       N|                       |
	'   |                       |  |       \_____  |=======================|
	'   |                       |  |
	'   |                       | 512 Bytes
	'   |                       | text blocks
	'   :                       :  |
	'   :                       :  |                 Unused block
	'   :                       :  |           __  |=======================|
	'   :                       :  |          /   0| Pointer to next free  |
	'   :                       :  |         /    1| block                 |
	'   :                       :  |        /     2|                       |
	'   |                       |  |       /      3|                       |
	'511|                       |  |      /        |-----------------------|
	'   |=======================| _|_____/        4| Pointer to next used  |
	'  1|                       |  |              5| block                 |
	'   :                       :  |              6|                       |
	'   :                       :  |              7|                       |
	'   |                       |  |               |-----------------------|
	'511|                       | _|_____         8| ( Reserved )          |
	'   |=======================|  |     \         :                       :
	'  1|                       |  |      \       N|                       |
	'   |                       |  |       \_____  |=======================|
	'   |                       |  |
	'   :                       :  |
	'   |                       |  |
	'   |-----------------------| _|_____
	'   | Field terminator (1Ah)|  |  ^
	'   |-----------------------|  |  |Terminating field
	'   | Field terminator (1Ah)|  |  |within the block *3
	'   |-----------------------| _|__v__
	'   : ( Unused )            :  |
	'511|                       :  |
	'   |=======================| _v_____
	'   |                       |  ^
	'   |                       |  |
	'   |                       | 512 Bytes
	'   |                       | text blocks
	'   :                       :  |
	'   :                       :  |
	'   |                       |  |
	'   |                       | _v_____
	'   |=======================|

    <Record(FieldMapping:=FieldMapping.ExplicitColumnsOnly)> _
     Friend NotInheritable Class DbtHeader
        <Column(AdvancedType:=AdvancedColumnType.Int32)> _
        Public FirstAvailableBlock As Int32
        'Number of next available block for appending data (binary) 
        <Column(AdvancedType:=AdvancedColumnType.DELAYED, Width:=12)> _
        Public Reserved1 As [Byte]()

        <Column(AdvancedType:=AdvancedColumnType.[BYTE])> _
        Public NdtVersion As [Byte]

        <Column(AdvancedType:=AdvancedColumnType.DELAYED, Width:=3)> _
        Public Reserved2 As [Byte]()

        <Column(AdvancedType:=AdvancedColumnType.UINT16)> _
        Public BlockLength As UInt16
    End Class


End Namespace
